package com.jumi.test;

import com.jumi.microservice.domain.GoodsSpuInventoryDTO;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ListSort {
    public static void main(String[] args) {

        List<Student> students = new ArrayList<>();

        students.add(new Student("abc", 12));
        students.add(new Student("bcd", 12));
        students.add(new Student("cde", 17));
        students.add(new Student("def", 25));
        students.add(new Student("efg", 15));

   /*     String s1 = "123.45";
        BigDecimal bg2 = new BigDecimal(s1);


        System.out.println(bg2.doubleValue());*/

        //这方法需要jdk1.8以上
        students.sort((x, y) -> Integer.compare(x.getAge(), y.getAge()));


        System.out.println(students.get(0));
        students.stream().forEach(s -> System.out.println(s));

   /*     BigDecimal bignum1 = new BigDecimal("10");

        BigDecimal bignum2 = new BigDecimal("5");

        BigDecimal bignum3 = null;

        bignum3 = bignum1.subtract(bignum2);

        System.out.println("求差：" + String.valueOf(bignum3));*/


        Map<Long, List<GoodsSpuInventoryDTO>> spuInventoryMap = new HashMap<>();

    /*    System.out.println(spuInventoryMap.get(1));
        List<GoodsSpuInventoryDTO> l = spuInventoryMap.get(1);

        for (GoodsSpuInventoryDTO goodsSpuInventoryDTO : l) {
            System.out.println(goodsSpuInventoryDTO.getSpuId());
        }
*/

    }
}